﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Web.Services;

namespace MagicAclarant.WebSite
{
    public partial class contacto : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        [WebMethod]
        public static string EnviarCorreo(string nombre, string email, string telefono, string consulta)
        {
            string From = "ventas@magic-aclarant.com", To = "ventas@magic-aclarant.com", Subject = string.Empty, Body = string.Empty;

            Subject = "Consulta / Comentario";

            Body = "<table style='border: 1px solid #999; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px'>";
            Body += "<tr>";
            Body += "<td style='font-size: 12px; font-family: Arial, Helvetica, Sans-serif;'>Nombre</td>";
            Body += "<td style='font-size: 12px; font-family: Arial, Helvetica, Sans-serif;'>" + nombre + "</td>";
            Body += "</tr>";
            Body += "<tr>";
            Body += "<td style='font-size: 12px; font-family: Arial, Helvetica, Sans-serif;'>E-mail</td>";
            Body += "<td style='font-size: 12px; font-family: Arial, Helvetica, Sans-serif;'>" + email + "</td>";
            Body += "</tr>";
            Body += "<tr>";
            Body += "<td style='font-size: 12px; font-family: Arial, Helvetica, Sans-serif;'>Teléfono / Celular</td>";
            Body += "<td style='font-size: 12px; font-family: Arial, Helvetica, Sans-serif;'>" + telefono + "</td>";
            Body += "</tr>";
            Body += "<tr>";
            Body += "<td style='font-size: 12px; font-family: Arial, Helvetica, Sans-serif;'>Consulta / Comentario</td>";
            Body += "<td style='font-size: 12px; font-family: Arial, Helvetica, Sans-serif;'>" + consulta + "</td>";
            Body += "</tr>";
            Body += "</table>";

            Correo obj = new Correo();

            string envio = obj.EnviarCorreo(From, To, Subject, Body);
            string respuesta = string.Empty;

            if (envio.Equals("Ok"))
            {
                respuesta = "Le responderemos a la brevedad. Muchas gracias por contactarse con nosotros.";        
            }

            return respuesta;
        }
    }
}